package com.shrcl.engineerprocess.domain.events;

import com.shrcl.engineerprocess.domain.Engineer;
import com.shrcl.engineerprocess.domain.EngineerCapability;
import com.shrcl.engineerprocess.domain.EngineerCertification;
import com.shrcl.engineerprocess.domain.EngineerLevel;
import com.shrcl.engineerprocess.domain.EngineerMonthlyCost;
import com.shrcl.engineerprocess.domain.events.EngineerEventsListener;
import edu.fudan.mylang.pf.event.EntityEventsManager;
import java.util.Collection;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("com.shrcl.engineerprocess.domain.events.EngineerEventsManager")
public class EngineerEventsManager extends EntityEventsManager<Engineer> {
  @Autowired(required = false)
  private Collection<EngineerEventsListener> listeners = com.google.common.collect.Lists.newArrayList();;
  
  protected Collection<EngineerEventsListener> getListeners() {
    return listeners;
  }
  
  public void fireLeave(final Engineer entity) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerEventsListener)listener).leave(entity);
    }
    
  }
  
  public void fireReactive(final Engineer entity) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerEventsListener)listener).reactive(entity);
    }
    
  }
  
  public void fireAddCapability(final Engineer entity, final Procedure1<? super EngineerCapability> init) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerEventsListener)listener).addCapability(entity,init);
    }
    
  }
  
  public void fireAddCertification(final Engineer entity, final Procedure1<? super EngineerCertification> init) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerEventsListener)listener).addCertification(entity,init);
    }
    
  }
  
  public void fireRemoveCapability(final Engineer entity, final EngineerCapability engineerCapability) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerEventsListener)listener).removeCapability(entity,engineerCapability);
    }
    
  }
  
  public void fireRemoveCertification(final Engineer entity, final EngineerCertification engineerCertification) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerEventsListener)listener).removeCertification(entity,engineerCertification);
    }
    
  }
  
  public void fireAddMonthlyCost(final Engineer entity, final Procedure1<? super EngineerMonthlyCost> init) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerEventsListener)listener).addMonthlyCost(entity,init);
    }
    
  }
  
  public void fireRemoveMonthlyCost(final Engineer entity, final EngineerMonthlyCost monthlyCost) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerEventsListener)listener).removeMonthlyCost(entity,monthlyCost);
    }
    
  }
  
  public void fireUpdateEngineerLevels(final Engineer entity, final Collection<EngineerLevel> levels) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerEventsListener)listener).updateEngineerLevels(entity,levels);
    }
    
  }
  
  public void fireMonthlyCostTimer(final Engineer entity) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((EngineerEventsListener)listener).monthlyCostTimer(entity);
    }
    
  }
}
